﻿using Lg.Core.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lg.Core
{
    public static class ReflectionHelper
    {
        public static T? CreateInstance<T>(string fullName,string assemblyName)
        {
           Type? type = Type.GetType($"{fullName},{assemblyName}");
            if (type != null)
            {
                object? instance = Activator.CreateInstance(type,true);
                if (instance != null)
                {
                    return (T)instance;
                }
                else
                {
                    return default(T);
                }
            }
            return default(T);
        }
    }
}
